package com.edu.whty.dao;


import com.edu.whty.entity.capacity.GradeInfo;
import com.edu.whty.entity.capacity.PeriodInfo;
import com.edu.whty.entity.capacity.SubjectInfo;
import com.edu.whty.entity.disk.ChartDataDto;
import com.edu.whty.entity.school.*;

import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 校本资源dao接口类
 *
 */

public interface SchoolResourceDao   {

	/**
	 * 校本资源文件夹目录查询
	 *
	 */
	List<ProdOwner> getFolderTreeByOrgId(Map<String, Object> params);

	/**
	 *
	 * 获取文件夹下面的资源数量
	 *
	 */
	long getResCountByDirId(Map<String, Object> map);

	/**
	 *
	 * 校本资源分页查询列表
	 *
	 */
	List<ProdOwner> queryForSchResPagination( ProdOwner prodOwner);

	/**
	 *
	 * 获取根目录下面无章节的资源数量
	 *
	 */
	long getResCountInRootDirNoChapterId(Map<String, Object> params);

	/**
	 * 获取校本资源文件夹下的子文件夹
	 *
	 */
	List<ProdOwner> getFolderByDirID(Map<String, Object> params);

	void saveSchoolResBatch(List<ProdOwner>list) throws Exception;

	ProdOwner selectOne(java.lang.String productCode) throws Exception;

	ProdOwner selectOneByResId(java.lang.String resId) throws Exception;


	int selectExists(String dirId)throws Exception;

	void updateDownCount(ProdOwner prodOwner) throws Exception;

    void updateViewCount(ProdOwner prodOwner) throws Exception;

    void updateOpenCount(ProdOwner prodOwner) throws Exception;

	void saveResCount(SchoolCount schoolCount);

    void updateBatch(List<ProdOwner>list) throws Exception;

    ResAttrValue queryAttrSpecByCode(ResAttrValueDto attrValueDto);

	List<BaseTextbookDto> queryTextbookPrivByUser(TextbookPrivDto entity);

	List<SpecialResourcesBaseDto> queryCataBasePrivWithoutAudit(VisualRangePrivDto specialCataloguePriv);

	List<SpecialResourceCatalogDto> queryCataloguePrivWithoutAudit(VisualRangePrivDto specialCataloguePriv);

	List<SpecialResourcesBase> selectSelfAndSubscribedRepo(Map<String, Object> mapParam);

	List<SpecialResourceCatalogDto> selectListByModel(SpecialResourceCatalogDto param);

	int getSchoolResPrivExist(String privId);

	void saveSchoolResPrivBatch(List<VisualRangePrivDto> listAdd);

	void batchUpSchoolResPriv(List<VisualRangePrivDto> listUpdate);

    void saveSchoolRes(ProdOwner prodOwner);

	void auditResource(ProdOwner prodOwner);

	void batchUpdateSync(List<String> list);

	void editSpecialResource(@Param("list") List<SpecialResourcesBase> specialResourcesBases);

	void deleteSchoolRes(ProdOwner prodOwner);

	void updateResource(ProdOwner prodOwner);

	/**
	 * 校本资源的类型统计
	 * @return
	 */
	List<ChartDataDto> getSchoolResClassification(SchoolResQuery params);

	/**
	 * 同步、专题资源统计
	 * @return
	 */
	List<ChartDataDto> getSchoolResRepo(SchoolResQuery params);

	/**
	 * 按资源格式分布
	 * @return
	 */
	List<ChartDataDto> getSchoolResExt(SchoolResQuery params);

	/**
	 * 查询老师资源数排名
	 * @param params
	 * @return
	 */
	List<TeacherResNumDto> getSchoolResTeacher(SchoolResQuery params);

	/**
	 * 按年级学科分布
	 * @return
	 */
	List<GradeSubjectDto> getSchoolResGrade(SchoolResQuery params);

	/**
	 * 统计最近30天的文件操作次数
	 * @return
	 */
	List<SchoolResDto> getSchoolResByDay();

	/**
	 * 统计最近12周的文件操作次数
	 * @return
	 */
	List<SchoolResDto> getSchoolResByWeek();

	/**
	 * 统计最近6个月的文件操作次数
	 * @return
	 */
	List<SchoolResDto> getSchoolResByHalfMonth();

	/**
	 * 统计最近12个月的文件操作次数
	 * @return
	 */
	List<SchoolResDto> getSchoolResByMonth();

	/**
	 * 学科列表
	 * @return
	 */
	List<SubjectInfo> listSchoolSubject();

	/**
	 * 年级列表
	 * @return
	 */
	List<GradeInfo> listSchoolGrade(@Param("periodId") String periodId);

	/**
	 * 学段列表
	 * @return
	 */
	List<PeriodInfo> listSchoolPeriod();

	/**
	 * 获取学校已使用容量(校本资源库)
	 * @param orgId
	 * @return
	 * @throws Exception
	 */
	Long getSchoolCapacity(String orgId);


}
